package com.khoayang.littlefighterchaos.menu;

import java.util.ArrayList;

import org.cocos2d.layers.CCLayer;
import org.cocos2d.menus.CCMenu;
import org.cocos2d.menus.CCMenuItemImage;
import org.cocos2d.nodes.CCDirector;
import org.cocos2d.nodes.CCSprite;
import org.cocos2d.types.CGSize;

import com.khoayang.littlefighterchaos.game.BackgoundGame;

import android.content.Context;

public class ChooseMap extends CCLayer{
	
	private Context _context;
	
	private CCMenu chooseMapMenu;
	
	public ChooseMap(Context context)
	{
		_context = context;
		CGSize winSize = CCDirector.sharedDirector().winSize();
		
		CCMenuItemImage map1;
		map1 = CCMenuItemImage.item("main-menu/map1.png","main-menu/map1.png", this, "chosenMap1");
		
		CCMenuItemImage map2;
		map2 = CCMenuItemImage.item("main-menu/map2.png","main-menu/map2.png", this, "chosenMap2");
		
		CCMenu chooseMapMenu = CCMenu.menu(map1, map2);
		map1.setPosition(-winSize.width/5, 0);
		map2.setPosition(+winSize.width/5,0);
		addChild(chooseMapMenu);
		
	}
	
	public void chosenMap1(Object sender)
	{
		BackgoundGame.ground1 = "background-game/ground1.png";
		BackgoundGame.ground2 = "background-game/ground1.png";
		BackgoundGame.ground3 = "background-game/ground1.png";
		BackgoundGame.sky = "background-game/sky1.jpg";
		
		ChooseCharacterLayer chooseCharacterLayer = new ChooseCharacterLayer(_context);
		getParent().addChild(chooseCharacterLayer);
		this.removeFromParentAndCleanup(true);
		
		
	}
	
	public void chosenMap2(Object sender)
	{
		BackgoundGame.ground1 = "background-game/ground2.png";
		BackgoundGame.ground2 = "background-game/ground2.png";
		BackgoundGame.ground3 = "background-game/ground2.png";
		BackgoundGame.sky = "background-game/sky2.bmp";
		
		ChooseCharacterLayer chooseCharacterLayer = new ChooseCharacterLayer(_context);
		getParent().addChild(chooseCharacterLayer);
		this.removeFromParentAndCleanup(true);
		
		
	}
}
